package com.lagou.edu;

import java.io.IOException;
import java.io.InputStream;

public class Request {

    private String method;
    private String url;

    public Request(InputStream inputStream) throws IOException {
        int count = 0;
        while(count == 0){
            count = inputStream.available();
        }
        byte[] bytes = new byte[count];
        inputStream.read(bytes);
        String split = new String(bytes).split("\\n")[0];
        String[] value = split.split(" ");
        this.method = value[0];
        this.url = value[1];
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }
}
